package es.gesfutbol.domini.implementacio;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import es.gesfutbol.domini.ICombinacioGeneral;

@Entity
@Table(name="combinacio_general")
public class CombinacioGeneral implements ICombinacioGeneral {

	private static final long serialVersionUID = -7048581776099407138L;

	private Long idCombinacioGeneral;

	private String nom;
	
	private Integer numeroFixos;
	
	private Integer numeroDobles;
	
	private Integer numeroTriples;
	
	private Set<Pronostic> pronostics;
	
	private Set<Penya> penyes;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="idCombGeneral", nullable=false, precision=10, scale=0)
	public Long getIdCombinacioGeneral() {
		return idCombinacioGeneral;
	}

	public void setIdCombinacioGeneral(Long idCombinacioGeneral) {
		this.idCombinacioGeneral = idCombinacioGeneral;
	}
	
	@Column(name="nom", nullable=false, length=45)
	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	@Column(name="numFixos", nullable=false, precision=10, scale=0)
	public Integer getNumeroFixos() {
		return numeroFixos;
	}

	public void setNumeroFixos(Integer numeroFixos) {
		this.numeroFixos = numeroFixos;
	}

	@Column(name="numDobles", nullable=false, precision=10, scale=0)
	public Integer getNumeroDobles() {
		return numeroDobles;
	}

	public void setNumeroDobles(Integer numeroDobles) {
		this.numeroDobles = numeroDobles;
	}

	@Column(name="numTriples", nullable=false, precision=10, scale=0)
	public Integer getNumeroTriples() {
		return numeroTriples;
	}

	public void setNumeroTriples(Integer numeroTriples) {
		this.numeroTriples = numeroTriples;
	}

	@OneToMany(fetch=FetchType.LAZY, mappedBy="combinacioGeneral", cascade=CascadeType.ALL)
	public Set<Pronostic> getPronostics() {
		return pronostics;
	}

	public void setPronostics(Set<Pronostic> pronostics) {
		this.pronostics = pronostics;
	}

	@ManyToMany(mappedBy="combGenerals")
	public Set<Penya> getPenyes() {
		return penyes;
	}

	public void setPenyes(Set<Penya> penyes) {
		this.penyes = penyes;		
	}
}